<template>
    <div class="brand-box">
<!--        <h1>我的天</h1>-->
        <div class="search-box">
            <el-form :inline="true" class="demo-form-inline" size="mini">
                <el-form-item label="存货档案编码" style="float: left">
                    <el-input placeholder="存货档案编码" v-model="searchParams.productId"></el-input>
                </el-form-item>
                <el-form-item label="产品型号" style="float: left">
                    <el-input placeholder="产品型号" v-model="searchParams.productModel"></el-input>
                </el-form-item>


                    <el-form-item label="基础库-颜色" :label-width="formLabelWidth" prop="colorId" style="float: left">
                        <el-select v-model="searchParams.colorId">
                            <el-option v-for="type in colorList" :key="type.colorId" :label="type.colorName"
                                       :value="type.colorId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="基础库-产品品牌" :label-width="formLabelWidth" prop="brandId" style="float: left">
                        <el-select v-model="searchParams.brandId">
                            <el-option v-for="type in brandList" :key="type.brandId" :label="type.brandName"
                                       :value="type.brandId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="基础库-产品分类" :label-width="formLabelWidth" prop="typeId" style="float: left">
                        <el-select v-model="searchParams.typeId">
                            <el-option v-for="type in typeList" :key="type.typeId" :label="type.typeName"
                                       :value="type.typeId">
                            </el-option>
                        </el-select>
                    </el-form-item>


                <el-form-item>
                    <el-button type="primary" @click="findPage" style="margin-left: 600px">查询</el-button>
                    <el-button type="warning" @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <!--操作按钮 @click="dialogVisible=true,formData={},imageUrl=''"-->
        <div class="crud-box">
            <el-button style="margin-right: 52px;float: right" type="primary" icon="el-icon-edit" size="mini"
                      >同步
            </el-button>
<!--            <el-button type="success" icon="el-icon-edit" size="mini">修改</el-button>-->
<!--            <el-button type="danger" icon="el-icon-delete" size="mini">删除</el-button>-->
        </div>
        <!--table展示数据-->
        <div class="table-box">
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    @selection-change="checkBoxSelectionChange"
            >

                <el-table-column
                        type="selection"
                        width="55">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="productId"
                        label="存货档案编码"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="productType"
                        label="基础库-分类"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="productBrand"
                        label="基础库-品牌">

                </el-table-column>
                <el-table-column
                        align="center"
                        prop="productModel"
                        label="基础库-型号">
                    <!--                    <template v-slot="obj">-->
                    <!--                        <img :src="obj.row.brandLogo" height="35px">-->
                    <!--                    </template>-->

                </el-table-column>
                <el-table-column
                        align="center"
                        prop="productColor"
                        label="基础库-颜色"
                        width="180">
                </el-table-column>
            </el-table>
        </div>
        <!--分页-->
        <div class="page-box">
            <el-pagination
                    background
                    :current-page="searchParams.currentPage"
                    :page-size="searchParams.pageSize"
                    layout="prev, pager, next"
                    @current-change="currentPageChange"
                    :total="total">
            </el-pagination>
        </div>


        <!--弹框-->
        <div class="dialog-box">
            <el-dialog
                    title="添加"
                    :visible.sync="dialogVisible"
                    width="40%"
            >
                <el-form ref="form" :model="formData" label-width="240px">
                    <el-form-item label="产品型号" style="margin-right: 200px">
                        <el-input placeholder="产品型号" v-model="formData.productModel" style="width: 205px"></el-input>
                    </el-form-item>


                    <el-form-item label="基础库-颜色" :label-width="formLabelWidth" prop="colorId" style="margin-left: 120px">
                        <el-select v-model="formData.productColorid">
                            <el-option v-for="type in colorList" :key="type.colorId" :label="type.colorName"
                                       :value="type.colorId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <br>
                    <el-form-item label="基础库-产品品牌" :label-width="formLabelWidth" prop="brandId" style="margin-left: 120px">
                        <el-select v-model="formData.productBrandid">
                            <el-option v-for="type in brandList" :key="type.brandId" :label="type.brandName"
                                       :value="type.brandId">
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="基础库-产品分类" :label-width="formLabelWidth" prop="typeId" style="margin-left: 120px">
                        <el-select v-model="formData.productTypeid">
                            <el-option v-for="type in typeList" :key="type.typeId" :label="type.typeName"
                                       :value="type.typeId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <br>
                <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false" size="small">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false,addOrEdit()" size="small">确 定</el-button>
                </span>
            </el-dialog>

        </div>
        <div class="dialog-box">
            <el-dialog
                    title="修改"
                    :visible.sync="dialogVisibleEdit"
                    width="40%"
            >
                <el-form ref="form" :model="formDataEdit" label-width="240px">
                    <el-form-item label="产品型号" style="margin-right: 200px">
                        <el-input placeholder="产品型号" v-model="formDataEdit.productModel" style="width: 205px"></el-input>
                    </el-form-item>


                    <el-form-item label="基础库-颜色" :label-width="formLabelWidth" prop="colorId" style="margin-left: 120px">
                        <el-select v-model="formDataEdit.productColorid">
                            <el-option v-for="type in colorList" :key="type.colorId" :label="type.colorName"
                                       :value="type.colorId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <br>
                    <el-form-item label="基础库-产品品牌" :label-width="formLabelWidth" prop="brandId" style="margin-left: 120px">
                        <el-select v-model="formDataEdit.productBrandid">
                            <el-option v-for="type in brandList" :key="type.brandId" :label="type.brandName"
                                       :value="type.brandId">
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="基础库-产品分类" :label-width="formLabelWidth" prop="typeId" style="margin-left: 120px">
                        <el-select v-model="formDataEdit.productTypeid">
                            <el-option v-for="type in typeList" :key="type.typeId" :label="type.typeName"
                                       :value="type.typeId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <br>
                <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisibleEdit = false" size="small">取 消</el-button>
    <el-button type="primary" @click="dialogVisibleEdit = false,productEdit()" size="small">确 定</el-button>
                </span>
            </el-dialog>
        </div>
    </div>

</template>

<script>
    import productquery from './productquery'

    export default productquery;
</script>

<style src="./index.scss" lang="scss">
</style>